home *** CD-ROM | disk | FTP | other *** search
/ CD Ware Multimedia 1995 May / cd Ware (Juegos) Epimundo.iso / WIN / VB_TOOLS / VBCOUNT.ZIP / FRMMAIN.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-04-01  |  25.8 KB  |  767 lines

  1. VERSION 2.00
  2. Begin Form frmMain 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "VB Code Counter"
  5.    ClientHeight    =   4845
  6.    ClientLeft      =   1110
  7.    ClientTop       =   1545
  8.    ClientWidth     =   6615
  9.    Height          =   5280
  10.    Icon            =   FRMMAIN.FRX:0000
  11.    Left            =   1035
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    ScaleHeight     =   323
  15.    ScaleMode       =   3  'Pixel
  16.    ScaleWidth      =   441
  17.    Top             =   1185
  18.    Width           =   6765
  19.    Begin OptionButton optMode 
  20.       Caption         =   "Approx. Module Size"
  21.       Height          =   240
  22.       Index           =   1
  23.       Left            =   2790
  24.       TabIndex        =   13
  25.       Top             =   2205
  26.       Width           =   2040
  27.    End
  28.    Begin OptionButton optMode 
  29.       Caption         =   "Lines of Code"
  30.       Height          =   240
  31.       Index           =   0
  32.       Left            =   2790
  33.       TabIndex        =   21
  34.       Top             =   1935
  35.       Value           =   -1  'True
  36.       Width           =   1500
  37.    End
  38.    Begin PictureBox picProgress 
  39.       FillColor       =   &H00000080&
  40.       FillStyle       =   0  'Solid
  41.       ForeColor       =   &H00000080&
  42.       Height          =   1380
  43.       Left            =   1080
  44.       ScaleHeight     =   1350
  45.       ScaleWidth      =   210
  46.       TabIndex        =   25
  47.       TabStop         =   0   'False
  48.       Top             =   2955
  49.       Visible         =   0   'False
  50.       Width           =   240
  51.    End
  52.    Begin CommandButton cmdCredit 
  53.       Caption         =   " &Credit"
  54.       FontBold        =   0   'False
  55.       FontItalic      =   0   'False
  56.       FontName        =   "MS Serif"
  57.       FontSize        =   6
  58.       FontStrikethru  =   0   'False
  59.       FontUnderline   =   0   'False
  60.       Height          =   240
  61.       Left            =   5490
  62.       TabIndex        =   8
  63.       Top             =   1260
  64.       Width           =   555
  65.    End
  66.    Begin PictureBox picFrame 
  67.       Height          =   1770
  68.       Left            =   1575
  69.       ScaleHeight     =   116
  70.       ScaleMode       =   3  'Pixel
  71.       ScaleWidth      =   314
  72.       TabIndex        =   22
  73.       TabStop         =   0   'False
  74.       Top             =   2745
  75.       Width           =   4740
  76.       Begin VScrollBar vsbResults 
  77.          Height          =   1740
  78.          Left            =   4455
  79.          TabIndex        =   9
  80.          Top             =   0
  81.          Visible         =   0   'False
  82.          Width           =   270
  83.       End
  84.       Begin PictureBox picResults 
  85.          AutoRedraw      =   -1  'True
  86.          BorderStyle     =   0  'None
  87.          FontBold        =   0   'False
  88.          FontItalic      =   0   'False
  89.          FontName        =   "MS Sans Serif"
  90.          FontSize        =   8.25
  91.          FontStrikethru  =   0   'False
  92.          FontUnderline   =   0   'False
  93.          Height          =   1365
  94.          Left            =   0
  95.          ScaleHeight     =   91
  96.          ScaleMode       =   3  'Pixel
  97.          ScaleWidth      =   740
  98.          TabIndex        =   23
  99.          TabStop         =   0   'False
  100.          Top             =   0
  101.          Width           =   11100
  102.       End
  103.    End
  104.    Begin CommandButton cmdExit 
  105.       Caption         =   "E&xit"
  106.       Height          =   330
  107.       Left            =   5310
  108.       TabIndex        =   7
  109.       Top             =   765
  110.       Width           =   915
  111.    End
  112.    Begin CommandButton cmdOK 
  113.       Caption         =   "&OK"
  114.       Default         =   -1  'True
  115.       Height          =   330
  116.       Left            =   5310
  117.       TabIndex        =   6
  118.       Top             =   360
  119.       Width           =   915
  120.    End
  121.    Begin FileListBox lstMak 
  122.       Height          =   810
  123.       Left            =   1590
  124.       Pattern         =   "*.mak"
  125.       TabIndex        =   1
  126.       Top             =   345
  127.       Width           =   1260
  128.    End
  129.    Begin DirListBox lstDir 
  130.       Height          =   1380
  131.       Left            =   3075
  132.       TabIndex        =   3
  133.       Top             =   345
  134.       Width           =   1890
  135.    End
  136.    Begin DriveListBox lstDrive 
  137.       Height          =   315
  138.       Left            =   1590
  139.       TabIndex        =   5
  140.       Top             =   1410
  141.       Width           =   1260
  142.    End
  143.    Begin Label lblCurFile 
  144.       BackStyle       =   0  'Transparent
  145.       FontBold        =   0   'False
  146.       FontItalic      =   0   'False
  147.       FontName        =   "MS Sans Serif"
  148.       FontSize        =   8.25
  149.       FontStrikethru  =   0   'False
  150.       FontUnderline   =   0   'False
  151.       ForeColor       =   &H00000080&
  152.       Height          =   240
  153.       Left            =   180
  154.       TabIndex        =   29
  155.       Top             =   2235
  156.       Width           =   2400
  157.    End
  158.    Begin Label lblProgress 
  159.       BackStyle       =   0  'Transparent
  160.       ForeColor       =   &H00000080&
  161.       Height          =   420
  162.       Left            =   510
  163.       TabIndex        =   26
  164.       Top             =   3420
  165.       Visible         =   0   'False
  166.       Width           =   465
  167.    End
  168.    Begin Label lblProgBar 
  169.       Alignment       =   1  'Right Justify
  170.       BackColor       =   &H00000000&
  171.       BackStyle       =   0  'Transparent
  172.       Caption         =   "0"
  173.       FontBold        =   0   'False
  174.       FontItalic      =   0   'False
  175.       FontName        =   "MS Sans Serif"
  176.       FontSize        =   8.25
  177.       FontStrikethru  =   0   'False
  178.       FontUnderline   =   0   'False
  179.       Height          =   195
  180.       Index           =   1
  181.       Left            =   630
  182.       TabIndex        =   28
  183.       Top             =   4170
  184.       Visible         =   0   'False
  185.       Width           =   420
  186.    End
  187.    Begin Label lblProgBar 
  188.       Alignment       =   1  'Right Justify
  189.       BackStyle       =   0  'Transparent
  190.       Caption         =   "100"
  191.       FontBold        =   0   'False
  192.       FontItalic      =   0   'False
  193.       FontName        =   "MS Sans Serif"
  194.       FontSize        =   8.25
  195.       FontStrikethru  =   0   'False
  196.       FontUnderline   =   0   'False
  197.       ForeColor       =   &H00000000&
  198.       Height          =   195
  199.       Index           =   0
  200.       Left            =   630
  201.       TabIndex        =   27
  202.       Top             =   2925
  203.       Visible         =   0   'False
  204.       Width           =   420
  205.    End
  206.    Begin Label Label1 
  207.       BackColor       =   &H00FFFFFF&
  208.       BackStyle       =   0  'Transparent
  209.       Caption         =   "(bytes)"
  210.       FontBold        =   0   'False
  211.       FontItalic      =   0   'False
  212.       FontName        =   "MS Sans Serif"
  213.       FontSize        =   8.25
  214.       FontStrikethru  =   0   'False
  215.       FontUnderline   =   0   'False
  216.       ForeColor       =   &H00000000&
  217.       Height          =   195
  218.       Index           =   11
  219.       Left            =   4860
  220.       TabIndex        =   24
  221.       Top             =   2235
  222.       Width           =   645
  223.    End
  224.    Begin Label lblTotEvent 
  225.       Alignment       =   1  'Right Justify
  226.       BackColor       =   &H00FFFFFF&
  227.       BackStyle       =   0  'Transparent
  228.       Caption         =   "0"
  229.       ForeColor       =   &H00800000&
  230.       Height          =   195
  231.       Left            =   3900
  232.       TabIndex        =   19
  233.       Top             =   4545
  234.       Width           =   1005
  235.       WordWrap        =   -1  'True
  236.    End
  237.    Begin Label lblTotal 
  238.       Alignment       =   1  'Right Justify
  239.       BackColor       =   &H00FFFFFF&
  240.       BackStyle       =   0  'Transparent
  241.       Caption         =   "0"
  242.       ForeColor       =   &H00800000&
  243.       Height          =   195
  244.       Left            =   4950
  245.       TabIndex        =   20
  246.       Top             =   4545
  247.       Width           =   1005
  248.       WordWrap        =   -1  'True
  249.    End
  250.    Begin Label lblTotProp 
  251.       Alignment       =   1  'Right Justify
  252.       BackColor       =   &H00FFFFFF&
  253.       BackStyle       =   0  'Transparent
  254.       Caption         =   "0"
  255.       ForeColor       =   &H00800000&
  256.       Height          =   195
  257.       Left            =   2805
  258.       TabIndex        =   18
  259.       Top             =   4545
  260.       Width           =   1050
  261.       WordWrap        =   -1  'True
  262.    End
  263.    Begin Label lblTotUnits 
  264.       BackColor       =   &H00FFFFFF&
  265.       BackStyle       =   0  'Transparent
  266.       Caption         =   "TOTAL Lines"
  267.       Height          =   195
  268.       Left            =   1590
  269.       TabIndex        =   17
  270.       Top             =   4545
  271.       Width           =   1500
  272.       WordWrap        =   -1  'True
  273.    End
  274.    Begin Label Label1 
  275.       BackColor       =   &H00FFFFFF&
  276.       BackStyle       =   0  'Transparent
  277.       Caption         =   "(w/o blanks or comments)"
  278.       FontBold        =   0   'False
  279.       FontItalic      =   0   'False
  280.       FontName        =   "MS Sans Serif"
  281.       FontSize        =   8.25
  282.       FontStrikethru  =   0   'False
  283.       FontUnderline   =   0   'False
  284.       ForeColor       =   &H00000000&
  285.       Height          =   195
  286.       Index           =   8
  287.       Left            =   4320
  288.       TabIndex        =   15
  289.       Top             =   1965
  290.       Width           =   1950
  291.       WordWrap        =   -1  'True
  292.    End
  293.    Begin Label Label1 
  294.       Alignment       =   1  'Right Justify
  295.       BackColor       =   &H00FFFFFF&
  296.       BackStyle       =   0  'Transparent
  297.       Caption         =   "Total"
  298.       FontBold        =   0   'False
  299.       FontItalic      =   0   'False
  300.       FontName        =   "MS Sans Serif"
  301.       FontSize        =   8.25
  302.       FontStrikethru  =   0   'False
  303.       FontUnderline   =   0   'False
  304.       Height          =   195
  305.       Index           =   7
  306.       Left            =   4980
  307.       TabIndex        =   14
  308.       Top             =   2520
  309.       Width           =   960
  310.    End
  311.    Begin Label Label1 
  312.       BackColor       =   &H00FFFFFF&
  313.       BackStyle       =   0  'Transparent
  314.       Caption         =   "&Directory"
  315.       FontBold        =   0   'False
  316.       FontItalic      =   0   'False
  317.       FontName        =   "MS Sans Serif"
  318.       FontSize        =   8.25
  319.       FontStrikethru  =   0   'False
  320.       FontUnderline   =   0   'False
  321.       Height          =   195
  322.       Index           =   6
  323.       Left            =   3105
  324.       TabIndex        =   2
  325.       Top             =   135
  326.       Width           =   1005
  327.    End
  328.    Begin Label Label1 
  329.       BackColor       =   &H00FFFFFF&
  330.       BackStyle       =   0  'Transparent
  331.       Caption         =   "&File"
  332.       FontBold        =   0   'False
  333.       FontItalic      =   0   'False
  334.       FontName        =   "MS Sans Serif"
  335.       FontSize        =   8.25
  336.       FontStrikethru  =   0   'False
  337.       FontUnderline   =   0   'False
  338.       Height          =   195
  339.       Index           =   5
  340.       Left            =   1590
  341.       TabIndex        =   0
  342.       Top             =   135
  343.       Width           =   1005
  344.    End
  345.    Begin Label Label1 
  346.       Alignment       =   1  'Right Justify
  347.       BackColor       =   &H00FFFFFF&
  348.       BackStyle       =   0  'Transparent
  349.       Caption         =   "Procedures"
  350.       FontBold        =   0   'False
  351.       FontItalic      =   0   'False
  352.       FontName        =   "MS Sans Serif"
  353.       FontSize        =   8.25
  354.       FontStrikethru  =   0   'False
  355.       FontUnderline   =   0   'False
  356.       Height          =   195
  357.       Index           =   2
  358.       Left            =   3885
  359.       TabIndex        =   12
  360.       Top             =   2520
  361.       Width           =   1005
  362.    End
  363.    Begin Label Label1 
  364.       Alignment       =   1  'Right Justify
  365.       BackColor       =   &H00FFFFFF&
  366.       BackStyle       =   0  'Transparent
  367.       Caption         =   "Forms/Controls"
  368.       FontBold        =   0   'False
  369.       FontItalic      =   0   'False
  370.       FontName        =   "MS Sans Serif"
  371.       FontSize        =   8.25
  372.       FontStrikethru  =   0   'False
  373.       FontUnderline   =   0   'False
  374.       Height          =   195
  375.       Index           =   1
  376.       Left            =   2430
  377.       TabIndex        =   11
  378.       Top             =   2520
  379.       Width           =   1410
  380.       WordWrap        =   -1  'True
  381.    End
  382.    Begin Label Label1 
  383.       BackColor       =   &H00FFFFFF&
  384.       BackStyle       =   0  'Transparent
  385.       Caption         =   "Module"
  386.       Height          =   195
  387.       Index           =   0
  388.       Left            =   1590
  389.       TabIndex        =   10
  390.       Top             =   2520
  391.       Width           =   1005
  392.    End
  393.    Begin Label Label1 
  394.       Alignment       =   1  'Right Justify
  395.       BackColor       =   &H00FFFFFF&
  396.       BackStyle       =   0  'Transparent
  397.       Caption         =   "Select a VB project .MAK file, then click the OK button."
  398.       ForeColor       =   &H00800000&
  399.       Height          =   1095
  400.       Index           =   9
  401.       Left            =   45
  402.       TabIndex        =   16
  403.       Top             =   360
  404.       Width           =   1410
  405.       WordWrap        =   -1  'True
  406.    End
  407.    Begin Label Label1 
  408.       BackColor       =   &H00FFFFFF&
  409.       BackStyle       =   0  'Transparent
  410.       Caption         =   "Dri&ve"
  411.       FontBold        =   0   'False
  412.       FontItalic      =   0   'False
  413.       FontName        =   "MS Sans Serif"
  414.       FontSize        =   8.25
  415.       FontStrikethru  =   0   'False
  416.       FontUnderline   =   0   'False
  417.       Height          =   195
  418.       Index           =   4
  419.       Left            =   1590
  420.       TabIndex        =   4
  421.       Top             =   1200
  422.       Width           =   1005
  423.    End
  424. 'VB CODE COUNTER
  425. '------------------------
  426. 'This mini-app counts the code lines and characters
  427. 'in each of a VB project's modules, then displays either
  428. 'the total lines of code or the approximate byte size
  429. 'for each module and for the project as a whole.
  430. 'Comments in the code should make apparent just how it
  431. 'works. The interesting part mostly is in cmdOK_Click and
  432. 'the procedures it calls.
  433. 'See the README.TXT file for more info.
  434. '(Note: the program expects that all project files
  435. 'have been saved in ASCII format.)
  436. 'Allan Colby
  437. '4/1/94
  438. 'CIS 71257,760
  439. '---------------------------------
  440. Option Explicit
  441. Option Compare Text
  442. 'housekeeping variables
  443. Dim msProjFile$()      'full path to files read from list in .MAK
  444. Dim mnNumFiles%        'number of files in project
  445. Dim msCurFileTitle$    'name only for file currently being read
  446. Dim mbShowBytes%       'mode selected by user - bytes or lines of code
  447. Dim mbFormatOK%        'flag to denote if current file passed check for ASCII format
  448. 'data variables
  449. Dim mlPropLines&       'current count of form/control property definition lines
  450. Dim mlEventLines&      'as above for event procedure lines
  451. Dim mlPropBytes&       'current count of form/control property definition characters
  452. Dim mlEventBytes&      'as above for event procedure bytes
  453. Dim mlTotPropLines&    '\
  454. Dim mlTotEventLines&   ' [Running totals for the four items above]
  455. Dim mlTotPropBytes&    '
  456. Dim mlTotEventBytes&   '/
  457. Sub cmdCredit_Click ()
  458.     MsgBox "Created 3/84 by" & Chr$(13) & Chr$(10) & "Allan Colby" & Chr$(13) & Chr$(10) & "CIS 71257,760", 64
  459. End Sub
  460. Sub cmdExit_Click ()
  461.     End
  462. End Sub
  463. Sub cmdOK_Click ()
  464.     Dim n%, f$
  465.     Static RunningFlag  'prevents re-click during a DoEvents
  466.             '(numerous DoEvents calls are included
  467.             'to ensure action occurs and screen repaints)
  468.     If RunningFlag Then Exit Sub
  469.     On Error GoTo NoFileErr
  470.     'Check that valid MAK file is selected
  471.     f = lstMAK.Path & "\" & lstMAK.FileName
  472.     If Not FileExists(f) Then
  473.     MsgBox "Cannot find that .MAK file.", 48, Me.Caption
  474.     Exit Sub
  475.     End If
  476.      
  477.     'If so, reset form and proceed.
  478.     screen.MousePointer = 11
  479.     RunningFlag = True
  480.     picResults.Cls
  481.     picResults.Height = picFrame.ScaleHeight - 1
  482.     picResults.Top = 0
  483.     mlTotPropLines = 0
  484.     mlTotEventLines = 0
  485.     mlTotPropBytes = 0
  486.     mlTotEventBytes = 0
  487.     mnNumFiles = 0
  488.     lblTotProp = "0"
  489.     lblTotEvent = "0"
  490.     lblTotal = "0"
  491.     DoEvents
  492.     'get project info
  493.     ReadMAK
  494.     'set up and show progress bar if there's more than 1 file
  495.     If mnNumFiles > 1 Then
  496.     picProgress.Cls
  497.     picProgress.Visible = True
  498.     lblProgBar(0).Visible = True
  499.     lblProgBar(1).Visible = True
  500.     lblProgress = "0%"
  501.     lblProgress.Visible = True
  502.     DoEvents
  503.     End If
  504.     'get data from each file
  505.     For n = 0 To mnNumFiles - 1
  506.     SetProgressBar n
  507.     DoEvents
  508.     'extract FileName from FileSpec and set variable
  509.     f = msProjFile(n)
  510.     Do Until InStr(f, "\") = False
  511.          f = Right(f, Len(f) - InStr(f, "\"))
  512.     Loop
  513.     msCurFileTitle = f
  514.     'display what we're currently working on
  515.     lblCurFile = "Reading: " & msCurFileTitle
  516.     DoEvents
  517.     ReadFile msProjFile(n)
  518.     DoEvents
  519.     Next
  520.     'hide progress bar & status label
  521.     picProgress.Visible = False
  522.     lblProgBar(0).Visible = False
  523.     lblProgBar(1).Visible = False
  524.     lblProgress.Visible = False
  525.     'set status label
  526.     If mnNumFiles = 1 Then f = " file read." Else f = " files read."
  527.     lblCurFile = UCase(lstMAK.FileName) & ": " & mnNumFiles & f
  528.     screen.MousePointer = 0
  529.     RunningFlag = False
  530.     'signal completion
  531.     Beep
  532.     Exit Sub
  533. NoFileErr:
  534.     MsgBox "No file selected, or could not locate selected file.", 48
  535.     RunningFlag = False
  536.     screen.MousePointer = 0
  537.     Exit Sub
  538.     Resume
  539. End Sub
  540. Function FileExists (FileName As String) As Integer
  541.     Dim Test$
  542.     On Error Resume Next
  543.     'If Dir returns anything but an error or empty
  544.     'string, file must exist.
  545.     Test$ = Dir$(FileName)
  546.     If Test$ = "" Or Err <> 0 Then
  547.     FileExists = False
  548.     Else
  549.     FileExists = True
  550.     End If
  551. End Function
  552. Sub Form_Load ()
  553.     'Center form
  554.     Me.Move (screen.Width - Me.Width) / 2, .9 * (screen.Height - Me.Height) / 2
  555.     mbShowBytes = optMode(1)  'init value
  556. End Sub
  557. Sub lstDir_Change ()
  558.     lstMAK.Path = lstDir.Path
  559. End Sub
  560. Sub lstDrive_Change ()
  561.     lstDir.Path = lstDrive.Drive
  562. End Sub
  563. Sub lstMak_DblClick ()
  564.     cmdOK_Click
  565. End Sub
  566. Sub optMode_Click (Index As Integer)
  567.     'set mode flag
  568.     mbShowBytes = optMode(1)
  569.     'position display pic box so approp. info is visible
  570.     If mbShowBytes Then picResults.Left = -440 Else picResults.Left = 0
  571.     'reset Total values
  572.     SetTotals
  573. End Sub
  574. Sub ReadFile (FileSpec$)
  575.     'Read each file to count valid lines and characters
  576.     Dim f%, n%, t$   'temp variables & counters
  577.     Dim LineRead$    'current line read
  578.     Dim CountingProperties%   'flag for whether we're in form/control properties section
  579.     Dim ReadingString%   'flag for whether we're inside a string
  580.     'init variables
  581.     mlPropLines = 0
  582.     mlEventLines = 0
  583.     mlPropBytes = 0
  584.     mlEventBytes = 0
  585.     mbFormatOK = False
  586.     CountingProperties = False
  587.     ReadingString = False
  588.     'open file
  589.     f = FreeFile
  590.     Open FileSpec For Input As #f
  591.     Do Until EOF(f)
  592.     'get each line
  593.     Line Input #f, LineRead
  594.         
  595.     'remove any leading spaces or tabs
  596.     Do Until Left(LineRead, 1) <> " " And Left(LineRead, 1) <> Chr$(9)
  597.         LineRead = Right(LineRead, Len(LineRead) - 1)
  598.     Loop
  599.     '[This next bit is done only on the first pass.]
  600.     '------------------------------------------------------------------
  601.     'check for ASCII format; apparently, if 1st line starts with Chr(255)
  602.     'or Chr(252), file was saved in binary and not ASCII format.
  603.     If Not mbFormatOK Then
  604.         If Left(LineRead, 1) = Chr(255) Or Left(LineRead, 1) = Chr(252) Then
  605.         'skip to print routine
  606.         Close #f
  607.         ShowResults
  608.         Exit Sub
  609.         Else
  610.         'set flag so we skip this on subsequent passes for this file
  611.         mbFormatOK = True
  612.         End If
  613.     End If
  614.     '------------------------------------------------------------------
  615.     'make sure line isn't blank or a comment
  616.     If LineRead <> "" And Left(LineRead, 1) <> "'" Then
  617.         'otherwise flag if it's starting a form or control properties definition,
  618.         'which starts with "Begin ". [Note: Must include space after "Begin" to
  619.         'avoid finding "BeginTrans" in an event procedure.]
  620.         If Left(LineRead, 6) = "Begin " Then CountingProperties = True
  621.         'add to the properties or procedures count as approp.
  622.         If CountingProperties Then mlPropLines = mlPropLines + 1 Else mlEventLines = mlEventLines + 1
  623.         'clear flag if ending properties section
  624.         '(Note: Any "End ..." statement in event procedure section has no impact
  625.         'as flag already will have been cleared.)
  626.         If LineRead = "End" Then CountingProperties = False
  627.         'count characters in LineRead, except for line-end comments
  628.         n = 0   'init counter
  629.         Do
  630.         'increment counter
  631.         n = n + 1
  632.         'get next character
  633.          t = Mid(LineRead, n, 1)
  634.         'keep track of whether we're inside a string (t = ")
  635.         If t = Chr$(34) Then ReadingString = Not ReadingString
  636.         'If there's an apostrophe that's not inside a string, it
  637.         'must be the start of a line-end comment, so bail out
  638.         If Not ReadingString And t = Chr$(39) Then Exit Do
  639.         'if we get this far, it's a countable character,
  640.         'so increment TotBytes
  641.         If CountingProperties Then mlPropBytes = mlPropBytes + 1 Else mlEventBytes = mlEventBytes + 1
  642.         Loop Until n = Len(LineRead)
  643.         'at end of line, add 2 bytes for CR+LF, which Input Line trims
  644.         If CountingProperties Then mlPropBytes = mlPropBytes + 2 Else mlEventBytes = mlEventBytes + 2
  645.     End If
  646.     Loop
  647.     Close #f
  648.     'set total values
  649.     mlTotPropLines = mlTotPropLines + mlPropLines
  650.     mlTotEventLines = mlTotEventLines + mlEventLines
  651.     mlTotPropBytes = mlTotPropBytes + mlPropBytes
  652.     mlTotEventBytes = mlTotEventBytes + mlEventBytes
  653.     'Display results for this file
  654.     ShowResults
  655. End Sub
  656. Sub ReadMAK ()
  657.     Dim f%          'file number
  658.     Dim MAKFile$    'full path to .MAK file
  659.     Dim LineRead$   'current line from .MAK file
  660.     Dim temp$       'temp string
  661.     f = FreeFile
  662.     mnNumFiles = 0
  663.     'open MAK file
  664.     MAKFile = lstMAK.Path & "\" & lstMAK.FileName
  665.     Open MAKFile For Input As #f
  666.     Do Until EOF(f)
  667.     'get each line
  668.     Line Input #f, LineRead
  669.     'if LineRead contains no backslash, it might be a
  670.     'filename in same dir with MAK, so append MAK path
  671.     'to front.
  672.     If Not InStr(LineRead, "\") Then temp = lstMAK.Path & "\" & LineRead Else temp = LineRead
  673.     'now see if line (as modified) is a valid file name
  674.     If FileExists(temp) Then
  675.         'if so, check that it's not a .VBX
  676.         If Right(temp, 4) <> ".VBX" Then
  677.         'if not a .VBX, store its full path and
  678.         'increment NumFiles counter
  679.         ReDim Preserve msProjFile(mnNumFiles + 1)
  680.         msProjFile(mnNumFiles) = temp
  681.         mnNumFiles = mnNumFiles + 1
  682.         End If
  683.     End If
  684.     Loop
  685.     Close #f
  686. End Sub
  687. Sub SetProgressBar (CurIndex As Integer)
  688.     Dim p!, h%, w%
  689.     'determine current file index as proportion of total
  690.     p = (CurIndex + 1) / mnNumFiles
  691.     If p = 1 Then p = .99   'don't show 100%
  692.     'draw colored box in pic box relative to p
  693.     w = picProgress.ScaleWidth
  694.     h = picProgress.ScaleHeight
  695.     picProgress.Line (0, h)-(w, (h - p * h)), , BF
  696.     'update progress label
  697.     lblProgress = Format(p, "0%") & " done"
  698. End Sub
  699. Sub SetTotals ()
  700.     'place total values in approp. labels
  701.     If Not mbShowBytes Then     'showing lines of code
  702.     lblTotProp = mlTotPropLines
  703.     lblTotEvent = mlTotEventLines
  704.     lblTotal = mlTotPropLines + mlTotEventLines
  705.     lblTotUnits = "TOTAL Lines"
  706.     Else                        'showing bytes
  707.     lblTotProp = mlTotPropBytes
  708.     lblTotEvent = mlTotEventBytes
  709.     lblTotal = mlTotPropBytes + mlTotEventBytes
  710.     lblTotUnits = "TOTAL Bytes"
  711.     End If
  712. End Sub
  713. Sub ShowResults ()
  714.     'Add Results to pic box display
  715.     Dim t$    'temp string
  716.     'enlarge pic box and show scroll bar if nec.
  717.     If picResults.Height < (picResults.TextHeight("A") * mnNumFiles) Then picResults.Height = (picResults.TextHeight("A") * mnNumFiles)
  718.     If picResults.Height > picFrame.ScaleHeight Then
  719.     vsbResults.Max = picResults.Height - picFrame.ScaleHeight
  720.     vsbResults.LargeChange = picFrame.ScaleHeight
  721.     vsbResults.SmallChange = picResults.TextHeight("A")
  722.     vsbResults.Visible = True
  723.     DoEvents
  724.     End If
  725.     'Move the display pic box up if we've gotten to the bottom of the viewport
  726.     If picResults.CurrentY > picFrame.ScaleHeight Then vsbResults.Value = vsbResults.Value + vsbResults.SmallChange
  727.     'Print file name to pic box twice for different columns
  728.     '(we'll move the pic box to left or right depending on which info
  729.     ' the user wants to see.)
  730.     picResults.Print msCurFileTitle;
  731.     picResults.CurrentX = 440
  732.     picResults.Print msCurFileTitle;
  733.     '-----------------------------------------------------------
  734.     'If check for ASCII format failed, just append message (again in
  735.     'two columns) and bail out
  736.     If Not mbFormatOK Then
  737.     t = "[file not saved as text]"
  738.     picResults.CurrentX = 140
  739.     picResults.Print t;
  740.     picResults.CurrentX = 580
  741.     picResults.Print t
  742.     Exit Sub
  743.     End If
  744.     '-----------------------------------------------------------
  745.     'otherwise, continue with printing results as format check was OK
  746.     '(lines of code values)
  747.     picResults.CurrentX = 150 - picResults.TextWidth(Str(mlPropLines))
  748.     picResults.Print mlPropLines;
  749.     picResults.CurrentX = 220 - picResults.TextWidth(Str(mlEventLines))
  750.     picResults.Print mlEventLines;
  751.     picResults.CurrentX = 290 - picResults.TextWidth(Str(mlEventLines + mlPropLines))
  752.     picResults.Print mlEventLines + mlPropLines;
  753.     '(bytes values)
  754.     picResults.CurrentX = 590 - picResults.TextWidth(Str(mlPropBytes))
  755.     picResults.Print mlPropBytes;
  756.     picResults.CurrentX = 660 - picResults.TextWidth(Str(mlEventBytes))
  757.     picResults.Print mlEventBytes;
  758.     picResults.CurrentX = 730 - picResults.TextWidth(Str(mlPropBytes + mlEventBytes))
  759.     picResults.Print mlPropBytes + mlEventBytes
  760.     'display totals
  761.     SetTotals
  762. End Sub
  763. Sub vsbResults_Change ()
  764.     'reset vertical position of results pic box
  765.     picResults.Top = -vsbResults
  766. End Sub
  767.